#include<iostream>
#include<vector>
#include<string>
#include<map>
using namespace std;

class Solution {
public:
	int findKthLargest(vector<int>& nums, int k) {
		map<int,int> list;
		for (int i = 0; i < nums.size(); i++)
			list[nums[i]]++;
		map<int, int>::reverse_iterator rit=list.rbegin();
		while (k > 0) {
			k -= rit->second;
			if (k <= 0)
				break;
			else rit++;
		}
		return rit->first;
	}
};

int main() {

	Solution s;
	vector<int> arr = { 3,2,1,5,6,4 };
	vector<int>::iterator it = arr.begin();
	it = it + 5;
	int a=s.findKthLargest(arr, 2);
	return 0;
}